<template>
  <div class="SinglesPage">
    <div class="header">
      <img src="@assets/images/superSaleZJ/header.png" alt="" />
    </div>
    <div v-for="oneList in goodsList" :key="oneList.id" class="father">
      <div class="goodsList">
        <div class="dis">
          <img src="@assets/images/superSaleZJ/title.png" alt="" />
        </div>
        <div class="listDivSmall" v-if="oneList.listDivSmall.length > 0">
          <img
            @click="toDetail(img.id)"
            v-for="img in oneList.listDivSmall"
            :key="img.id"
            v-lazy="img.url"
            alt=""
          />
        </div>
        <div class="listDivBig" v-if="oneList.listDivBig.length > 0">
          <img
            @click="toDetail(img.id)"
            v-for="img in oneList.listDivBig"
            :key="img.id"
            v-lazy="img.url"
            alt=""
          />
        </div>
        <!-- <div class="lookmore" v-show="oneList.type == '2'">
                <p @click="toSalePage">更多特惠</p>
                <img @click="toSalePage" src="@assets/images/superSaleZJ/more.png" alt="" srcset="">
            </div> -->
      </div>
    </div>
  </div>
</template>
<script>
import Recommend from "@components/Recommend";
import cookie from "@utils/store/cookie";
import debounce from "lodash.debounce";
import share from "../../assets/js/common/share.js";
import shareMsg from "../../assets/js/common/shareConfig.js";
const CHECKED_IDS = "cart_checked";

export default {
  name: "SinglesPage",
  components: {
    Recommend,
  },
  props: {},
  data: function () {
    return {
      deg: "0",
      from1: "h5",
      goodsList: [
        {
          header: "限量特惠",
          type: "2",
          listDivBig: [
            {
              url: require("@assets/images/superSaleZJ/limit27.png"),
              id: "616",
            },
            {
              url: require("@assets/images/superSaleZJ/limit28.png"),
              id: "594",
            },
          ],
          listDivSmall: [
            {
              url: require("@assets/images/superSaleZJ/limit.png"),
              id: "624",
            },
            {
              url: require("@assets/images/superSaleZJ/limit1.png"),
              id: "595",
            },
            {
              url: require("@assets/images/superSaleZJ/limit2.png"),
              id: "620",
            },
            {
              url: require("@assets/images/superSaleZJ/limit3.png"),
              id: "607",
            },
            {
              url: require("@assets/images/superSaleZJ/limit4.png"),
              id: "615",
            },
            {
              url: require("@assets/images/superSaleZJ/limit5.png"),
              id: "609",
            },
            {
              url: require("@assets/images/superSaleZJ/limit6.png"),
              id: "611",
            },
            {
              url: require("@assets/images/superSaleZJ/limit7.png"),
              id: "628",
            },
            {
              url: require("@assets/images/superSaleZJ/limit8.png"),
              id: "625",
            },
            {
              url: require("@assets/images/superSaleZJ/limit9.png"),
              id: "600",
            },
            {
              url: require("@assets/images/superSaleZJ/limit10.png"),
              id: "617",
            },
            {
              url: require("@assets/images/superSaleZJ/limit11.png"),
              id: "613",
            },
            {
              url: require("@assets/images/superSaleZJ/limit12.png"),
              id: "629",
            },
            {
              url: require("@assets/images/superSaleZJ/limit13.png"),
              id: "621",
            },
            {
              url: require("@assets/images/superSaleZJ/limit14.png"),
              id: "619",
            },
            {
              url: require("@assets/images/superSaleZJ/limit15.png"),
              id: "623",
            },
            {
              url: require("@assets/images/superSaleZJ/limit16.png"),
              id: "614",
            },
            {
              url: require("@assets/images/superSaleZJ/limit17.png"),
              id: "610",
            },
            {
              url: require("@assets/images/superSaleZJ/limit18.png"),
              id: "612",
            },
            {
              url: require("@assets/images/superSaleZJ/limit19.png"),
              id: "626",
            },
            {
              url: require("@assets/images/superSaleZJ/limit20.png"),
              id: "604",
            },
            {
              url: require("@assets/images/superSaleZJ/limit21.png"),
              id: "601",
            },
            {
              url: require("@assets/images/superSaleZJ/limit22.png"),
              id: "627",
            },
            {
              url: require("@assets/images/superSaleZJ/limit23.png"),
              id: "618",
            },
            {
              url: require("@assets/images/superSaleZJ/limit24.png"),
              id: "603",
            },
            {
              url: require("@assets/images/superSaleZJ/limit25.png"),
              id: "599",
            },
            {
              url: require("@assets/images/superSaleZJ/limit26.png"),
              id: "602",
            },
          ],
        },
      ],
    };
  },
  watch: {},
  mounted: function () {
    if (this.$route.query.isToken) {
      this.$store.commit(
        "LOGIN",
        this.$route.query.isToken
        // dayjs(expires_time) - newTime
      );
      cookie.set("OID", this.$route.query.oId);
    }
    var shareUrl1 = window.location.href.split("?")[0];
    if (this.$route.query.from1 == "app") {
      shareMsg.shareConfig(
        "app",
        "0",
        "0",
        "湛江广播年货节",
        "听见广播",
        shareUrl1,
        "https://seefm.oss-cn-beijing.aliyuncs.com/image/icon.png",
        "",
        "1"
      );
    }
    share.share(
      shareUrl1,
      "湛江广播年货节",
      "听见广播",
      "https://seefm.oss-cn-beijing.aliyuncs.com/image/icon.png"
    );
    share.QQshare(
      shareUrl1,
      "湛江广播年货节",
      "听见广播",
      "https://seefm.oss-cn-beijing.aliyuncs.com/image/icon.png"
    );
  },
  created() {
    if (this.$route.query.from1) {
      this.from1 = this.$route.query.from1;
    }
    cookie.set("from1", this.from1);
    this.changeDeg();
    if (this.from1 == "app") {
      this.getTitle();
    }
  },
  methods: {
    changeDeg: function () {
      setInterval(() => {
        if (this.deg == "0") {
          this.deg = "5";
        } else {
          this.deg = "0";
        }
      }, 500);
    },

    toDetail: function (id) {
      if (this.from1 == "app") {
        this.$router.push({
          path: "/detail/" + id + "?mer_id=5070770&from1=" + this.from1,
        });
      } else {
        this.$router.push({
          path: "/detail/" + id + "?mer_id=5070770",
        });
      }
    },
    toListPage: function () {
      if (this.from1 == "app") {
        this.$router.push({
          path: "/goods_list/5070770?from1=" + this.from1 + "&isshowTui=1",
        });
      } else {
        this.$router.push({
          path: "/goods_list/5070770?isshowTui=1",
        });
      }
    },
    toSalePage: function () {
      if (this.from1 == "app") {
        this.$router.push({
          path: "/goods_list/5058293?from1=" + this.from1,
        });
      } else {
        this.$router.push({
          path: "/goods_list/5058293",
        });
      }
    },

    getTitle: function () {
      var self = this;
      var u = navigator.userAgent,
        app = navigator.appVersion;
      var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1; //g
      var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
      var obj = {
        action: "setTitle",
        content: {
          title: "湛江广播年货节",
        },
      };
      if (isAndroid) {
        App.onAppResponse(JSON.stringify(obj));
      }
    },
  },
};
</script>
<style scoped>
.SinglesPage {
  width: 100%;
  min-height: 100vh;
  height: auto;
  background: rgba(146, 2, 1, 1);
  overflow: hidden;
}
.SinglesPage .header {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 4.22rem;
  margin-bottom: 0.18rem;
}
.SinglesPage .header img {
  display: block;
  width: 100%;
  height: 100%;
}
.father {
  box-sizing: border-box;
  /* background-image: linear-gradient(180deg, rgba(255, 226, 191, 1), rgba(255, 229, 160, 0.16)); */
  border-radius: 0.08rem;
  /* padding: 0.03rem 0; */
  margin-bottom: 0.3rem;
  position: relative;
  z-index: 2;
  /* margin: 0 0.12rem; */
}
.SinglesPage .goodsList {
  width: 7.5rem;
  height: auto;
  /* background: linear-gradient(180deg, #EB3018 0%, rgba(223, 37, 37, 0.93) 100%); */
  border-radius: 0.08rem;
  /* border-radius: 0.08rem;
        border: 0.03rem solid; */
  /* border-image: linear-gradient(180deg, rgba(255, 226, 191, 1), rgba(255, 229, 160, 0.16)) 3 3; */
}
.SinglesPage .goodsList .lookmore {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 0.26rem;
  padding-bottom: 0.26rem;
}
.SinglesPage .goodsList .lookmore p {
  font-size: 0.28rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 0.4rem;
  margin: 0 0.08rem 0 2.92rem;
}
.SinglesPage .goodsList .lookmore img {
  width: 0.2rem;
}
.SinglesPage .dis {
  width: 100%;
  height: 1.12rem;
  margin-bottom: 0.2rem;
}
.SinglesPage .dis img {
  /* margin-top: 0.16rem; */
  width: 100%;
  height: 100%;
  display: block;
}
.SinglesPage .listDivSmall {
  width: 7.3rem;
  margin: 0 0.1rem 0 0.1rem;
  display: flex;
  box-sizing: border-box;
  display: -webkit-flex;
  justify-content: space-between;
  flex-direction: row;
  flex-wrap: wrap;
  height: auto;
  /* padding-bottom: 0.2rem; */
}
.SinglesPage .listDivSmall img {
  width: 2.38rem;
  height: 3.68rem;
  margin-bottom: 0.08rem;
}
.SinglesPage .listDivBig {
  width: 7.3rem;
  margin: 0 0.1rem 0.04rem 0.1rem;
  display: flex;
  display: -webkit-flex;
  justify-content: space-between;
  flex-direction: row;
  flex-wrap: wrap;
  height: auto;
}
.SinglesPage .listDivBig img {
  width: 3.6rem;
  height: 5.14rem;
  margin-bottom: 0.08rem;
}
.SinglesPage .bottomDiv1 {
  bottom: 0;
  position: fixed;
  z-index: 3;
  width: 100%;
  height: 1.36rem;
  background: #9c0000;
}
.SinglesPage .bottomDiv1 .bottomDiv {
  width: 100%;
  height: 1.36rem;
  display: flex;
  justify-content: flex-start;
}
.SinglesPage .bottomDiv .bg {
  height: 0.84rem;
  display: flex;
  justify-content: flex-start;
  width: 6.48rem;
  margin: 0.24rem 0.5rem 0.24rem 0.51rem;
  background: linear-gradient(180deg, #ffdfb8 0%, #ffb53c 100%);
  border-radius: 0.44rem;
}
.SinglesPage .bottomDiv p {
  font-size: 0.4rem;
  font-weight: 500;
  color: rgba(118, 50, 5, 1);
  line-height: 0.56rem;
  margin: 0.16rem 0.1rem 0.16rem 1.02rem;
  font-weight: 600;
}
.SinglesPage .bottomDiv .go {
  width: 0.8rem;
  height: 0.74rem;
  margin-right: 0.1rem;
  margin-top: 0.08rem;
}
.SinglesPage .bottomDiv .jian {
  width: 0.32rem;
  height: 0.32rem;
  margin-right: 0.86rem;
  margin-top: 0.28rem;
}
</style>
